package util;

import java.sql.Connection;
import java.sql.DriverManager;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class DBUtil {
	public static Connection getconnection() throws Exception{
		Class.forName("com.mysql.jdbc.Driver");
		return DriverManager.getConnection("jdbc:mysql://59.110.218.138:3306/group4?useUnicode=true&characterEncoding=utf-8&useSSL=false","group4","123");
	}
	
	public static Connection getConnectionByPool() throws Exception{
		Context context=new InitialContext();
		DataSource ds=(DataSource)context.lookup("java:comp/env/jdbc/hrs");
		return ds.getConnection();
	}
}
